<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="net.groupme.gui.rendering.constants.RENDERING_CONSTANTS"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

	<title>Welcome to GroupMe! ...where Semantic Web meets Web 2.0 - [Home]</title>
	<!-- meta tags, link to css:  -->
	<%@ include file="./jsp-includes/metaheader.jsp" %>
	
	<!--  Ajax-Includes -->
	<script type='text/javascript' src='<%= request.getContextPath()%>/dwr/interface/DWRGameManager.js'></script>
    <script type='text/javascript' src='./dwr/engine.js'></script>
	<script type='text/javascript' src='./dwr/util.js'> </script>
	<script src="./scriptaculous/prototype.js" type="text/javascript"></script>
	<script src="./scriptaculous/scriptaculous.js" type="text/javascript"></script>
    
    <script type="text/javascript" language="javascript">
    <!--//--><![CDATA[//><!--
	
	function lookingForTeamplayer(){
		DWRUtil.useLoadingMessage();
		DWRGameManager.isGameRunning('<%=request.getAttribute(VIEW_VOCABULARY.PARAMETER_GAME_ID)%>', lookingForTeamplayerCallback);
	}
	
	function lookingForTeamplayerCallback(running){
		if(running) {
			document.startGame.submit();
		}
		else {
			setTimeout("lookingForTeamplayer()", 3000);
		}
	}
	
	//init stuff:		
	function init() {
		lookingForTeamplayer();
		DWRUtil.useLoadingMessage();
	}

	//--><!]]>
    </script>
</head>
<body onload="init()">
	<!-- title image, logo:  -->
	<div id="header">
		<%@ include file="./game-includes/titleheader.jsp" %>
	</div>
	
	<!-- Menu: -->
	<div id="menu">
		<%@ include file="./jsp-includes/menu.jsp" %>
	</div>

	<!-- content -->
	<div id="main">
	<br/>
	<br/>
		<center>
			<h1><strong>Welcome to the GroupMe! Game.</strong></h1><br/>
			<h3><i>Waiting for teammate...</i></h3><br/><br/>
			<img src="<%= request.getContextPath() + RENDERING_CONSTANTS.RELATIVE_PATH_OF_AJAX_LOADING_IMAGE %>"/>
			<h3>Your topic is <i><%= request.getAttribute(VIEW_VOCABULARY.PARAMETER_GAME_TOPIC) %></i>.</h3>
		</center>
		<form name="startGame" action="<%= VIEW_VOCABULARY.ACTION_START_GAME%>"> 
			<input id="gameIdInput" type="hidden" name="<%= VIEW_VOCABULARY.PARAMETER_GAME_ID %>" value="<%=request.getAttribute(VIEW_VOCABULARY.PARAMETER_GAME_ID) %>"/> 
		</form>
		<br/><br/><br/><br/>
		<!-- footer -->
		<div id="footer">
			<%@ include file="./jsp-includes/footer.jsp" %>
		</div>
	</div>
	
</body>
</html>